{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "d:\\Program Files\\anaconda3\\envs\\neuronVis\\lib\\site-packages\\numpy\\_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:\n",
      "d:\\Program Files\\anaconda3\\envs\\neuronVis\\lib\\site-packages\\numpy\\.libs\\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll\n",
      "d:\\Program Files\\anaconda3\\envs\\neuronVis\\lib\\site-packages\\numpy\\.libs\\libopenblas64__v0.3.21-gcc_10_3_0.dll\n",
      "  warnings.warn(\"loaded more than 1 DLL from .libs:\"\n"
     ]
    }
   ],
   "source": [
    "import sys,copy,os,inspect\n",
    "if hasattr(sys.modules[__name__], '__file__'):\n",
    "    _file_name = __file__\n",
    "else:\n",
    "    _file_name = inspect.getfile(inspect.currentframe())\n",
    "CURRENT_FILE_PATH = os.path.dirname(_file_name)\n",
    "sys.path.append(os.getcwd()+\"/../neuronVis\")\n",
    "import matplotlib\n",
    "import matplotlib.pyplot as plt\n",
    "plt.rcParams['pdf.fonttype'] = 42\n",
    "plt.rcParams['ps.fonttype'] = 42\n",
    "matplotlib.use('module://matplotlib_inline.backend_inline')\n",
    "%matplotlib inline\n",
    "\n",
    "import IONData \n",
    "iondata = IONData.IONData()\n",
    "import pickle\n",
    "import Scene\n",
    "import numpy as np\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'S1': 'contr_1',\n",
       " 'S2': 'contr_2',\n",
       " 'S3': 'contr_3',\n",
       " 'S4': 'contr_4',\n",
       " 'S5': 'contr_5',\n",
       " 'S6': 'contr_6',\n",
       " 'S7': 'contr_7',\n",
       " 'S8': 'contr_8',\n",
       " 'S9': 'contr_9',\n",
       " 'S10': 'contr_10',\n",
       " 'S11': 'contr_11',\n",
       " 'S12': 'ip_1',\n",
       " 'S13': 'ip_2',\n",
       " 'S14': 'ip_3',\n",
       " 'S15': 'ip_4',\n",
       " 'S16': 'ip_5',\n",
       " 'S17': 'bi_1',\n",
       " 'S18': 'bi_2',\n",
       " 'S19': 'bi_3',\n",
       " 'S20': 'bi_4',\n",
       " 'S21': 'bi_5',\n",
       " 'S22': 'bi_6',\n",
       " 'S23': 'bi_7',\n",
       " 'S24': 'bi_8'}"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f = open('../resource/cluster_eachNeuron/cluster_eachNeuron.pckl', 'rb')\n",
    "obj = pickle.load(f)\n",
    "f.close()\n",
    "obj\n",
    "from collections import Counter\n",
    "Counter(obj[\"cluster_id\"])\n",
    "subtypes={}\n",
    "for i in range(1,25):\n",
    "    subtypename = ''\n",
    "    if i <12:\n",
    "        subtypename = 'contr_'\n",
    "        subtypes['S'+str(i)]=subtypename+str(i)\n",
    "\n",
    "    elif i<17:\n",
    "        subtypename = 'ip_'\n",
    "        subtypes['S'+str(i)]=subtypename+str(i-11)\n",
    "\n",
    "    elif i<25:\n",
    "        subtypename = 'bi_'\n",
    "        subtypes['S'+str(i)]=subtypename+str(i-16)\n",
    "subtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['211472004.swc',\n",
       " '211985005.swc',\n",
       " '211467030.swc',\n",
       " '221259002.swc',\n",
       " '211468061.swc',\n",
       " '220983022.swc',\n",
       " '221259014.swc',\n",
       " '211467032.swc',\n",
       " '211468062.swc',\n",
       " '220983027.swc',\n",
       " '221260041.swc',\n",
       " '211467037.swc',\n",
       " '221260040.swc',\n",
       " '220983018.swc',\n",
       " '220983030.swc',\n",
       " '211467035.swc',\n",
       " '220983019.swc',\n",
       " '211468058.swc',\n",
       " '221260031.swc',\n",
       " '221260025.swc',\n",
       " '211470048.swc',\n",
       " '221260026.swc',\n",
       " '211468039.swc',\n",
       " '221260037.swc',\n",
       " '220982023.swc',\n",
       " '220982022.swc',\n",
       " '211190035.swc',\n",
       " '220982020.swc',\n",
       " '220982021.swc',\n",
       " '210729058.swc',\n",
       " '211992065.swc',\n",
       " '211467049.swc',\n",
       " '220982025.swc',\n",
       " '211470045.swc',\n",
       " '221260028.swc',\n",
       " '220982027.swc',\n",
       " '221260029.swc',\n",
       " '220983028.swc',\n",
       " '211467038.swc',\n",
       " '220983029.swc',\n",
       " '221259018.swc',\n",
       " '211993047.swc',\n",
       " '211193003.swc',\n",
       " '211467029.swc']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f = open('../resource/cluster_eachNeuron/left_neuronlist.pckl', 'rb')\n",
    "mirrorobj = pickle.load(f)\n",
    "f.close()\n",
    "mirrorobj"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{'mirror': 0, 'sampleid': '211466', 'name': '012.swc'}, {'mirror': 0, 'sampleid': '211467', 'name': '004.swc'}, {'mirror': 0, 'sampleid': '211468', 'name': '031.swc'}, {'mirror': 0, 'sampleid': '211466', 'name': '009.swc'}, {'mirror': 0, 'sampleid': '211468', 'name': '033.swc'}, {'mirror': 0, 'sampleid': '211466', 'name': '027.swc'}, {'mirror': 0, 'sampleid': '220982', 'name': '043.swc'}, {'mirror': 0, 'sampleid': '211187', 'name': '007.swc'}, {'mirror': 0, 'sampleid': '211472', 'name': '019.swc'}, {'mirror': 0, 'sampleid': '220978', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '220982', 'name': '046.swc'}, {'mirror': 0, 'sampleid': '211468', 'name': '037.swc'}, {'mirror': 0, 'sampleid': '211188', 'name': '010.swc'}, {'mirror': 0, 'sampleid': '211185', 'name': '019.swc'}, {'mirror': 0, 'sampleid': '211472', 'name': '022.swc'}, {'mirror': 0, 'sampleid': '211472', 'name': '006.swc'}, {'mirror': 0, 'sampleid': '211467', 'name': '045.swc'}, {'mirror': 0, 'sampleid': '221100', 'name': '064.swc'}]\n",
      "[{'mirror': 0, 'sampleid': '211185', 'name': '016.swc'}, {'mirror': 0, 'sampleid': '211989', 'name': '021.swc'}, {'mirror': 0, 'sampleid': '211987', 'name': '012.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '038.swc'}, {'mirror': 0, 'sampleid': '220982', 'name': '014.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '031.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '037.swc'}, {'mirror': 0, 'sampleid': '211985', 'name': '034.swc'}, {'mirror': 0, 'sampleid': '210731', 'name': '034.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '025.swc'}, {'mirror': 0, 'sampleid': '211466', 'name': '026.swc'}, {'mirror': 0, 'sampleid': '211466', 'name': '036.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '032.swc'}, {'mirror': 0, 'sampleid': '210731', 'name': '035.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '040.swc'}, {'mirror': 0, 'sampleid': '211988', 'name': '029.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '079.swc'}, {'mirror': 0, 'sampleid': '211983', 'name': '027.swc'}, {'mirror': 0, 'sampleid': '210731', 'name': '033.swc'}, {'mirror': 0, 'sampleid': '211989', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '211988', 'name': '005.swc'}, {'mirror': 0, 'sampleid': '211988', 'name': '015.swc'}, {'mirror': 0, 'sampleid': '211988', 'name': '059.swc'}, {'mirror': 0, 'sampleid': '211185', 'name': '013.swc'}, {'mirror': 0, 'sampleid': '210731', 'name': '032.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '025.swc'}]\n",
      "[{'mirror': 0, 'sampleid': '210729', 'name': '016.swc'}, {'mirror': 0, 'sampleid': '211185', 'name': '030.swc'}, {'mirror': 0, 'sampleid': '211987', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '048.swc'}, {'mirror': 0, 'sampleid': '220979', 'name': '001.swc'}, {'mirror': 0, 'sampleid': '221252', 'name': '016.swc'}, {'mirror': 0, 'sampleid': '221252', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '039.swc'}, {'mirror': 0, 'sampleid': '221103', 'name': '008.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '040.swc'}, {'mirror': 0, 'sampleid': '211993', 'name': '017.swc'}, {'mirror': 0, 'sampleid': '211983', 'name': '008.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '034.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '012.swc'}, {'mirror': 0, 'sampleid': '210731', 'name': '015.swc'}, {'mirror': 1, 'sampleid': '221260', 'name': '026.swc'}, {'mirror': 0, 'sampleid': '221260', 'name': '019.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '041.swc'}, {'mirror': 0, 'sampleid': '211193', 'name': '001.swc'}]\n",
      "[{'mirror': 0, 'sampleid': '220979', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '221105', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '221259', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '220982', 'name': '030.swc'}, {'mirror': 0, 'sampleid': '221105', 'name': '008.swc'}, {'mirror': 0, 'sampleid': '220983', 'name': '008.swc'}, {'mirror': 0, 'sampleid': '211469', 'name': '007.swc'}, {'mirror': 0, 'sampleid': '221104', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '211989', 'name': '009.swc'}, {'mirror': 0, 'sampleid': '221260', 'name': '060.swc'}, {'mirror': 0, 'sampleid': '211473', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '221104', 'name': '008.swc'}]\n",
      "[{'mirror': 0, 'sampleid': '221100', 'name': '137.swc'}, {'mirror': 0, 'sampleid': '221099', 'name': '005.swc'}, {'mirror': 0, 'sampleid': '221099', 'name': '017.swc'}, {'mirror': 0, 'sampleid': '221105', 'name': '009.swc'}, {'mirror': 0, 'sampleid': '221099', 'name': '020.swc'}, {'mirror': 0, 'sampleid': '220981', 'name': '017.swc'}, {'mirror': 0, 'sampleid': '221098', 'name': '049.swc'}, {'mirror': 0, 'sampleid': '221099', 'name': '012.swc'}, {'mirror': 0, 'sampleid': '221099', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '221098', 'name': '022.swc'}, {'mirror': 0, 'sampleid': '221260', 'name': '063.swc'}, {'mirror': 0, 'sampleid': '221098', 'name': '042.swc'}, {'mirror': 0, 'sampleid': '221099', 'name': '019.swc'}, {'mirror': 0, 'sampleid': '221100', 'name': '123.swc'}, {'mirror': 0, 'sampleid': '221100', 'name': '133.swc'}, {'mirror': 0, 'sampleid': '211466', 'name': '016.swc'}, {'mirror': 0, 'sampleid': '221099', 'name': '001.swc'}]\n",
      "[{'mirror': 0, 'sampleid': '220982', 'name': '005.swc'}, {'mirror': 1, 'sampleid': '211993', 'name': '047.swc'}, {'mirror': 0, 'sampleid': '211988', 'name': '025.swc'}, {'mirror': 0, 'sampleid': '221255', 'name': '001.swc'}, {'mirror': 1, 'sampleid': '211193', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '221257', 'name': '025.swc'}, {'mirror': 0, 'sampleid': '221106', 'name': '002.swc'}, {'mirror': 1, 'sampleid': '221259', 'name': '014.swc'}, {'mirror': 1, 'sampleid': '211985', 'name': '005.swc'}, {'mirror': 1, 'sampleid': '221260', 'name': '037.swc'}, {'mirror': 0, 'sampleid': '220983', 'name': '017.swc'}]\n",
      "[{'mirror': 0, 'sampleid': '202568', 'name': '028.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '064.swc'}, {'mirror': 0, 'sampleid': '211190', 'name': '026.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '005.swc'}, {'mirror': 0, 'sampleid': '202568', 'name': '014.swc'}, {'mirror': 0, 'sampleid': '211985', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '221253', 'name': '001.swc'}, {'mirror': 0, 'sampleid': '211987', 'name': '008.swc'}, {'mirror': 0, 'sampleid': '221259', 'name': '012.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '034.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '066.swc'}, {'mirror': 0, 'sampleid': '210731', 'name': '013.swc'}, {'mirror': 0, 'sampleid': '221252', 'name': '010.swc'}]\n",
      "[{'mirror': 0, 'sampleid': '221106', 'name': '006.swc'}, {'mirror': 0, 'sampleid': '210731', 'name': '018.swc'}, {'mirror': 0, 'sampleid': '211192', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '220978', 'name': '004.swc'}, {'mirror': 0, 'sampleid': '221256', 'name': '025.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '006.swc'}, {'mirror': 0, 'sampleid': '221260', 'name': '023.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '011.swc'}, {'mirror': 0, 'sampleid': '221256', 'name': '012.swc'}, {'mirror': 0, 'sampleid': '221098', 'name': '001.swc'}, {'mirror': 0, 'sampleid': '221252', 'name': '006.swc'}, {'mirror': 0, 'sampleid': '211193', 'name': '006.swc'}, {'mirror': 0, 'sampleid': '211187', 'name': '021.swc'}, {'mirror': 0, 'sampleid': '211190', 'name': '013.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '004.swc'}, {'mirror': 0, 'sampleid': '220979', 'name': '005.swc'}, {'mirror': 0, 'sampleid': '211186', 'name': '004.swc'}, {'mirror': 0, 'sampleid': '221100', 'name': '142.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '007.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '017.swc'}, {'mirror': 0, 'sampleid': '211193', 'name': '013.swc'}, {'mirror': 0, 'sampleid': '221252', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '202568', 'name': '010.swc'}, {'mirror': 0, 'sampleid': '221098', 'name': '004.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '006.swc'}, {'mirror': 0, 'sampleid': '211992', 'name': '001.swc'}, {'mirror': 0, 'sampleid': '221252', 'name': '009.swc'}, {'mirror': 0, 'sampleid': '221100', 'name': '141.swc'}, {'mirror': 0, 'sampleid': '210729', 'name': '061.swc'}, {'mirror': 0, 'sampleid': '202568', 'name': '024.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '015.swc'}, {'mirror': 0, 'sampleid': '211186', 'name': '006.swc'}, {'mirror': 0, 'sampleid': '221256', 'name': '006.swc'}, {'mirror': 0, 'sampleid': '211192', 'name': '017.swc'}, {'mirror': 0, 'sampleid': '210728', 'name': '023.swc'}, {'mirror': 0, 'sampleid': '202568', 'name': '012.swc'}]\n",
      "[{'mirror': 0, 'sampleid': '211467', 'name': '023.swc'}, {'mirror': 0, 'sampleid': '211186', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '221259', 'name': '009.swc'}, {'mirror': 1, 'sampleid': '211468', 'name': '039.swc'}, {'mirror': 0, 'sampleid': '211467', 'name': '077.swc'}, {'mirror': 0, 'sampleid': '221259', 'name': '008.swc'}, {'mirror': 0, 'sampleid': '220983', 'name': '002.swc'}, {'mirror': 0, 'sampleid': '221259', 'name': '001.swc'}, {'mirror': 0, 'sampleid': '221257', 'name': '016.swc'}, {'mirror': 0, 'sampleid': '221106', 'name': '005.swc'}, {'mirror': 0, 'sampleid': '211186', 'name': '001.swc'}, {'mirror': 0, 'sampleid': '221256', 'name': '027.swc'}, {'mirror': 0, 'sampleid': '211467', 'name': '028.swc'}, {'mirror': 0, 'sampleid': '220983', 'name': '011.swc'}, {'mirror': 0, 'sampleid': '220981', 'name': '021.swc'}, {'mirror': 0, 'sampleid': '221260', 'name': '056.swc'}, {'mirror': 0, 'sampleid': '211993', 'name': '004.swc'}, {'mirror': 0, 'sampleid': '211467', 'name': '034.swc'}, {'mirror': 0, 'sampleid': '221259', 'name': '017.swc'}, {'mirror': 0, 'sampleid': '221103', 'name': '001.swc'}, {'mirror': 1, 'sampleid': '211472', 'name': '004.swc'}, {'mirror': 0, 'sampleid': '210731', 'name': '043.swc'}, {'mirror': 0, 'sampleid': '202568', 'name': '001.swc'}, {'mirror': 0, 'sampleid': '221260', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '221098', 'name': '014.swc'}, {'mirror': 0, 'sampleid': '221260', 'name': '057.swc'}, {'mirror': 1, 'sampleid': '211468', 'name': '062.swc'}, {'mirror': 0, 'sampleid': '221104', 'name': '003.swc'}, {'mirror': 0, 'sampleid': '211467', 'name': '018.swc'}, {'mirror': 0, 'sampleid': '211468', 'name': '069.swc'}, {'mirror': 0, 'sampleid': '220981', 'name': '014.swc'}, {'mirror': 0, 'sampleid': '211467', 'name': '087.swc'}, {'mirror': 0, 'sampleid': '221104', 'name': '010.swc'}, {'mirror': 0, 'sampleid': '211467', 'name': '019.swc'}, {'mirror': 0, 'sampleid': '221098', 'name': '007.swc'}, {'mirror': 0, 'sampleid': '220983', 'name': '042.swc'}]\n"
     ]
    }
   ],
   "source": [
    "selecttype=['S3','S5','S7','S12','S13','S14','S19','S20','S24']\n",
    "for type in selecttype:\n",
    "    neuronsintype = obj[obj['cluster_id']==subtypes[type]]\n",
    "    neurons=[]\n",
    "    for neuron in np.array(neuronsintype):\n",
    "        neurondict={}\n",
    "        neurondict['mirror']=0\n",
    "        if neuron[1] in mirrorobj:\n",
    "            neurondict['mirror']=1\n",
    "        neurondict['sampleid'] = neuron[1][0:6]\n",
    "        neurondict['name']=neuron[1][6:]\n",
    "        neurons.append(neurondict)\n",
    "    print(neurons)\n",
    "    #         allneuronScene.append(neurondict)\n",
    "    Scene.createScene(neurons,'../resource/scene/'+type+'.nv')\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{'color': {'r': '241', 'g': '198', 'b': '250'}, 'mirror': 0, 'name': '023.swc', 'sampleid': '211467'}, {'color': {'r': '127', 'g': '148', 'b': '186'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '211186'}, {'color': {'r': '227', 'g': '2', 'b': '206'}, 'mirror': 0, 'name': '009.swc', 'sampleid': '221259'}, {'color': {'r': '71', 'g': '93', 'b': '11'}, 'mirror': 1, 'name': '039.swc', 'sampleid': '211468'}, {'color': {'r': '136', 'g': '7', 'b': '219'}, 'mirror': 0, 'name': '077.swc', 'sampleid': '211467'}, {'color': {'r': '16', 'g': '152', 'b': '11'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '221259'}, {'color': {'r': '21', 'g': '164', 'b': '114'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '220983'}, {'color': {'r': '100', 'g': '172', 'b': '58'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '221259'}, {'color': {'r': '10', 'g': '49', 'b': '238'}, 'mirror': 0, 'name': '016.swc', 'sampleid': '221257'}, {'color': {'r': '53', 'g': '58', 'b': '7'}, 'mirror': 0, 'name': '005.swc', 'sampleid': '221106'}, {'color': {'r': '235', 'g': '173', 'b': '58'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '211186'}, {'color': {'r': '196', 'g': '38', 'b': '55'}, 'mirror': 0, 'name': '027.swc', 'sampleid': '221256'}, {'color': {'r': '40', 'g': '157', 'b': '190'}, 'mirror': 0, 'name': '028.swc', 'sampleid': '211467'}, {'color': {'r': '74', 'g': '243', 'b': '84'}, 'mirror': 0, 'name': '011.swc', 'sampleid': '220983'}, {'color': {'r': '126', 'g': '61', 'b': '97'}, 'mirror': 0, 'name': '021.swc', 'sampleid': '220981'}, {'color': {'r': '2', 'g': '209', 'b': '89'}, 'mirror': 0, 'name': '056.swc', 'sampleid': '221260'}, {'color': {'r': '227', 'g': '84', 'b': '139'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '211993'}, {'color': {'r': '21', 'g': '166', 'b': '123'}, 'mirror': 0, 'name': '034.swc', 'sampleid': '211467'}, {'color': {'r': '180', 'g': '251', 'b': '215'}, 'mirror': 0, 'name': '017.swc', 'sampleid': '221259'}, {'color': {'r': '148', 'g': '219', 'b': '32'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '221103'}, {'color': {'r': '188', 'g': '249', 'b': '35'}, 'mirror': 1, 'name': '004.swc', 'sampleid': '211472'}, {'color': {'r': '162', 'g': '39', 'b': '229'}, 'mirror': 0, 'name': '043.swc', 'sampleid': '210731'}, {'color': {'r': '92', 'g': '5', 'b': '245'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '202568'}, {'color': {'r': '169', 'g': '94', 'b': '175'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '221260'}, {'color': {'r': '41', 'g': '107', 'b': '74'}, 'mirror': 0, 'name': '014.swc', 'sampleid': '221098'}, {'color': {'r': '234', 'g': '104', 'b': '140'}, 'mirror': 0, 'name': '057.swc', 'sampleid': '221260'}, {'color': {'r': '38', 'g': '77', 'b': '224'}, 'mirror': 1, 'name': '062.swc', 'sampleid': '211468'}, {'color': {'r': '48', 'g': '34', 'b': '127'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '221104'}, {'color': {'r': '132', 'g': '160', 'b': '227'}, 'mirror': 0, 'name': '018.swc', 'sampleid': '211467'}, {'color': {'r': '130', 'g': '247', 'b': '64'}, 'mirror': 0, 'name': '069.swc', 'sampleid': '211468'}, {'color': {'r': '17', 'g': '125', 'b': '110'}, 'mirror': 0, 'name': '014.swc', 'sampleid': '220981'}, {'color': {'r': '11', 'g': '145', 'b': '165'}, 'mirror': 0, 'name': '087.swc', 'sampleid': '211467'}, {'color': {'r': '110', 'g': '151', 'b': '10'}, 'mirror': 0, 'name': '010.swc', 'sampleid': '221104'}, {'color': {'r': '74', 'g': '34', 'b': '32'}, 'mirror': 0, 'name': '019.swc', 'sampleid': '211467'}, {'color': {'r': '111', 'g': '242', 'b': '22'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '221098'}, {'color': {'r': '18', 'g': '8', 'b': '207'}, 'mirror': 0, 'name': '042.swc', 'sampleid': '220983'}]\n",
      "Y:/bap/spinalcord/配准/show_spcd_swc_831/211186_003.swc\n"
     ]
    }
   ],
   "source": [
    "import Visual as nv\n",
    "import json\n",
    "import SwcLoader as nt\n",
    "import Scene\n",
    "import os\n",
    "import glutils,glm\n",
    "path = 'Y:/bap/spinalcord/配准/show_spcd_swc_831/'\n",
    "neuronvis = nv.neuronVis(size=(640,1080),renderModel=0)\n",
    "neuronvis.render.setBackgroundColor((0.0,0.0,0.,1.0))\n",
    "neuronvis.render.projection = glutils.perspective(neuronvis.render.fov, neuronvis.render.size[0] / float(neuronvis.render.size[1]),20000, 40000.0)\n",
    "index=3\n",
    "selecttype=['S3','S5','S7','S12','S13','S14','S19','S20','S24']\n",
    "selecttype=['S3','S5','S12','S24']\n",
    "colors = [[1,1,0],[0.8,0.5,0],[0,1,1],[0.5,0.8,1]]\n",
    "for type in selecttype[index:index+1]:\n",
    "    pathname=type+\"_2\"\n",
    "    if not os.path.exists('../resource/animation/'+pathname):\n",
    "        os.makedirs('../resource/animation/'+pathname)\n",
    "         \n",
    "        neurons = Scene.scene2List('../resource/scene/'+type+'.nv')\n",
    "        print(neurons)\n",
    "        for neuron in neurons[1:2]:\n",
    "            tree= nt.NeuronTree()\n",
    "            tree.somaRadius=100\n",
    "            filepath=path+neuron['sampleid']+'_'+neuron['name']\n",
    "            print(filepath)\n",
    "            if os.path.exists(filepath):\n",
    "                tree.readFile(filepath)\n",
    "                \n",
    "                neuronvis.addNeuronTree(tree,color=colors[index],somaColor=[1,1,1],mirrorToRight=neuron['mirror'],isLine=True)\n",
    "\n",
    "        neuronvis.render.setView('vontral')\n",
    "        neuronvis.render.view=glutils.lookAt(glm.vec3(0.,-30000,0.0),glm.vec3(0,0,0),glm.vec3(-1.0,0.0,0.0))\n",
    "\n",
    "        # neuronvis.render.animation(90*0)\n",
    "\n",
    "        neuronvis.render.animation(pathname,90*index)\n",
    "        # neuronvis.render.run()\n",
    "        # index=+1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/210661/146.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/210726/062.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/210726/131.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/210727/022.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/210662/073.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/211181/070.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/211984/001.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/210726/063.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/210727/045.swc\n",
      "exist  d:\\project\\python\\neuron-vis\\figures/../neuronVis/../resource/swc/210727/059.swc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "specified material (mtl1)  not loaded!\n",
      "specified material (mtl1)  not loaded!\n",
      "specified material (mtl1)  not loaded!\n",
      "specified material (mtl1)  not loaded!\n"
     ]
    }
   ],
   "source": [
    "import Visual as nv\n",
    "import json\n",
    "import SwcLoader as nt\n",
    "import Scene\n",
    "import os\n",
    "import glutils,glm\n",
    "\n",
    "neuronvis = nv.neuronVis(size=(1920,1080),renderModel=0)\n",
    "neuronvis.neuronWidth=0.3\n",
    "neuronvis.render.setBackgroundColor((0.0,0.0,0.,1.0))\n",
    "neuronvis.render.projection = glutils.perspective(neuronvis.render.fov, neuronvis.render.size[0] / float(neuronvis.render.size[1]),2000, 20000.0)\n",
    "index=0\n",
    "neuronvis.clear(root=True)\n",
    "\n",
    "type='TH_VPL'\n",
    "if not os.path.exists('../resource/animation/'+type):\n",
    "    os.makedirs('../resource/animation/'+type)\n",
    "         \n",
    "    neurons = Scene.scene2List('../resource/scene/'+type+'.nv')\n",
    "    neuronvis.addNeuronByList(neurons[::2],color=[1,1,0],dendriteColor=[1,1,0],somaColor=[1,1,1],isLine=True,axonHide=True)\n",
    "    neurons0 = Scene.scene2List('../resource/scene/'+'TH_MD'+'.nv')\n",
    "    neuronvis.addNeuronByList(neurons0[9:12],color=[0,1,0],dendriteColor=[0,0.8,0.8],somaColor=[1,1,1],isLine=True,axonHide=True)\n",
    "    neurons0 = Scene.scene2List('../resource/scene/'+'TH_SPFp'+'.nv')\n",
    "    neuronvis.addNeuronByList(neurons0[:],color=[0,1,0],dendriteColor=[1,0,0],somaColor=[1,1,1],isLine=True,axonHide=True)\n",
    "\n",
    "    neuronvis.render.setView('vontral')\n",
    "    neuronvis.addRegion('TH')\n",
    "    neuronvis.addRegion('MD')\n",
    "    neuronvis.addRegion('VPM')\n",
    "    neuronvis.addRegion('SPFp')\n",
    "    neuronvis.render.view=glutils.lookAt(glm.vec3(1000.,-8000,-0.0),glm.vec3(1000,0,-0),glm.vec3(-1.0,0.0,0.0))\n",
    "\n",
    "        # neuronvis.render.animation(90*0)\n",
    "\n",
    "    neuronvis.render.animation(type,90*index)\n",
    "    # neuronvis.render.run()\n",
    "        # index=+1"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## spinal dendrite"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'c1': ['../resource/show_clusters_swc/c1\\\\210731044.swc', '../resource/show_clusters_swc/c1\\\\220981004.swc', '../resource/show_clusters_swc/c1\\\\220981012.swc'], 'c10': ['../resource/show_clusters_swc/c10\\\\221104016.swc', '../resource/show_clusters_swc/c10\\\\221256012.swc', '../resource/show_clusters_swc/c10\\\\221256013.swc'], 'c11': ['../resource/show_clusters_swc/c11\\\\221104013.swc', '../resource/show_clusters_swc/c11\\\\221104017.swc', '../resource/show_clusters_swc/c11\\\\221255022.swc'], 'c12': ['../resource/show_clusters_swc/c12\\\\220981020.swc', '../resource/show_clusters_swc/c12\\\\220983008.swc', '../resource/show_clusters_swc/c12\\\\220983011.swc'], 'c13': ['../resource/show_clusters_swc/c13\\\\211190036.swc', '../resource/show_clusters_swc/c13\\\\211191002.swc', '../resource/show_clusters_swc/c13\\\\211985043.swc'], 'c14': ['../resource/show_clusters_swc/c14\\\\211193006.swc', '../resource/show_clusters_swc/c14\\\\220982020.swc', '../resource/show_clusters_swc/c14\\\\220982021.swc'], 'c15': ['../resource/show_clusters_swc/c15\\\\210728001.swc', '../resource/show_clusters_swc/c15\\\\210731010.swc', '../resource/show_clusters_swc/c15\\\\211185027.swc'], 'c2': ['../resource/show_clusters_swc/c2\\\\210729093.swc', '../resource/show_clusters_swc/c2\\\\211190002.swc', '../resource/show_clusters_swc/c2\\\\211190007.swc'], 'c3': ['../resource/show_clusters_swc/c3\\\\210728048.swc', '../resource/show_clusters_swc/c3\\\\211988016.swc', '../resource/show_clusters_swc/c3\\\\211988043.swc'], 'c4': ['../resource/show_clusters_swc/c4\\\\210729079.swc', '../resource/show_clusters_swc/c4\\\\211185032.swc', '../resource/show_clusters_swc/c4\\\\211983041.swc'], 'c5': ['../resource/show_clusters_swc/c5\\\\210731035.swc', '../resource/show_clusters_swc/c5\\\\211466026.swc', '../resource/show_clusters_swc/c5\\\\211985042.swc'], 'c6': ['../resource/show_clusters_swc/c6\\\\210728008.swc', '../resource/show_clusters_swc/c6\\\\210728037.swc', '../resource/show_clusters_swc/c6\\\\210729031.swc'], 'c7': ['../resource/show_clusters_swc/c7\\\\211467032.swc', '../resource/show_clusters_swc/c7\\\\211467036.swc', '../resource/show_clusters_swc/c7\\\\211467037.swc'], 'c8': ['../resource/show_clusters_swc/c8\\\\210731039.swc', '../resource/show_clusters_swc/c8\\\\211188005.swc', '../resource/show_clusters_swc/c8\\\\211471029.swc'], 'c9': ['../resource/show_clusters_swc/c9\\\\210731042.swc', '../resource/show_clusters_swc/c9\\\\211192004.swc', '../resource/show_clusters_swc/c9\\\\220983002.swc']}\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "cneurons={}\n",
    "def traverse_dir(path):\n",
    "    for file in os.listdir(path):\n",
    "        file_path = os.path.join(path, file)\n",
    "        if os.path.isdir(file_path):\n",
    "            # print(\"文件夹：\", file)\n",
    "            neurons=[]\n",
    "            for neuronfile in os.listdir(file_path):\n",
    "                neurons.append(os.path.join(file_path, neuronfile))\n",
    "\n",
    "            # traverse_dir(file_path)\n",
    "        else:\n",
    "            print(\"文件：\", file_path)\n",
    "        cneurons[file]=neurons\n",
    "\n",
    "dir_path = \"../resource/show_clusters_swc/\"\n",
    "# print('待遍历的目录为：', dir_path)\n",
    "# print('遍历结果为：')\n",
    "traverse_dir(dir_path)\n",
    "print(cneurons)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "import Visual as nv\n",
    "import SwcLoader as nt\n",
    "import glutils\n",
    "neuronvis = nv.neuronVis(size=(500,1000),renderModel=0,near=100,far=3000)\n",
    "\n",
    "neuronvis.render.setBackgroundColor((0.0,0.0,0.,1.0))\n",
    "\n",
    "# neuronvis.addRegion( color=[0.5, 1.0, 0.5],regionFileName=\"D:/neuron-vis/resource/allobj/Layer3.obj\")\n",
    "iondata = IONData.IONData()\n",
    "cluster=1\n",
    "clusterpath= '../resource/animation/dendrite'+str(cluster)\n",
    "colors=[[1,0,0],[0,1,0],[0,0,1]]\n",
    "if not  os.path.isdir(clusterpath):\n",
    "    os.mkdir(clusterpath)\n",
    "for i in range(cluster,cluster+1):\n",
    "    index=0\n",
    "    for neuronfile in cneurons['c'+str(i)]:\n",
    "        tree= nt.NeuronTree()\n",
    "        tree.readFile(neuronfile)\n",
    "        tree.somaRadius=4\n",
    "        tree.width=0.05\n",
    "        for p in tree.points:\n",
    "            p.xyz=[p.xyz[0]/10,p.xyz[1]/10,p.xyz[2]/10]\n",
    "        \n",
    "        neuronvis.addNeuronTree(tree,color=colors[index],somaColor=[1,1,1],isLine=False)\n",
    "        index+=1\n",
    "neuronvis.setLineWidth(0.02)\n",
    "\n",
    "neuronvis.render.setLookAt(eye=(0.,600.0,0),center=(0,0,0),up=(0,0.0,-1.0))\n",
    "neuronvis.render.animation('dendrite'+str(cluster),90*0)\n",
    "# neuronvis.render.run()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## new movie"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '037.swc', 'sampleid': '210728'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '020.swc', 'sampleid': '210731'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '013.swc', 'sampleid': '211188'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '009.swc', 'sampleid': '210729'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '015.swc', 'sampleid': '211188'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '027.swc', 'sampleid': '211983'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '005.swc', 'sampleid': '211988'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '034.swc', 'sampleid': '211991'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '029.swc', 'sampleid': '211988'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '211989'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '026.swc', 'sampleid': '210729'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '032.swc', 'sampleid': '210731'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '042.swc', 'sampleid': '211985'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '032.swc', 'sampleid': '210729'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '211989'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '018.swc', 'sampleid': '220982'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '015.swc', 'sampleid': '211988'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '019.swc', 'sampleid': '210729'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '038.swc', 'sampleid': '210729'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '033.swc', 'sampleid': '210731'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '079.swc', 'sampleid': '210729'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '041.swc', 'sampleid': '220982'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '031.swc', 'sampleid': '210729'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '034.swc', 'sampleid': '210731'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '013.swc', 'sampleid': '220981'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '036.swc', 'sampleid': '211466'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '014.swc', 'sampleid': '210731'}, {'color': {'r': '84', 'g': '22', 'b': '25'}, 'mirror': 0, 'name': '021.swc', 'sampleid': '211989'}]\n",
      "[{'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '015.swc', 'sampleid': '211190'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 1, 'name': '027.swc', 'sampleid': '220982'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '016.swc', 'sampleid': '221252'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '018.swc', 'sampleid': '211190'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '221260'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '211191'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '018.swc', 'sampleid': '210731'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '013.swc', 'sampleid': '202568'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '012.swc', 'sampleid': '211190'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '026.swc', 'sampleid': '211988'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '221257'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '030.swc', 'sampleid': '211985'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '029.swc', 'sampleid': '211185'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '221103'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '211190'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '211186'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '009.swc', 'sampleid': '220982'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '202568'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 1, 'name': '021.swc', 'sampleid': '220982'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '045.swc', 'sampleid': '211190'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '211987'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '019.swc', 'sampleid': '211989'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '013.swc', 'sampleid': '211193'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '220979'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '042.swc', 'sampleid': '211988'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '023.swc', 'sampleid': '221254'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 1, 'name': '026.swc', 'sampleid': '221260'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '014.swc', 'sampleid': '221260'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '017.swc', 'sampleid': '210728'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '043.swc', 'sampleid': '211985'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '211987'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '020.swc', 'sampleid': '211467'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '221253'}, {'color': {'r': '255', 'g': '224', 'b': '0'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '211988'}]\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211190_015.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/220982_027.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/221252_016.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211190_018.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/221260_001.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211191_004.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/210731_018.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/202568_013.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211190_012.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211988_026.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/221257_004.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211985_030.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211185_029.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/221103_008.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211190_001.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211186_007.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/220982_009.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/202568_007.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/220982_021.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211190_045.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211987_002.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211989_019.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211193_013.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/220979_001.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211988_042.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/221254_023.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/221260_026.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/221260_014.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/210728_017.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211985_043.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211987_003.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211467_020.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/221253_003.swc\n",
      "Y:/bap/spinalcord/show_spcd_swc_831/211988_004.swc\n",
      "[{'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '211187'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '031.swc', 'sampleid': '210728'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '035.swc', 'sampleid': '211985'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '221260'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '016.swc', 'sampleid': '211989'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '028.swc', 'sampleid': '210728'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '211993'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '054.swc', 'sampleid': '211190'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '018.swc', 'sampleid': '210728'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '022.swc', 'sampleid': '210728'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '016.swc', 'sampleid': '211988'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '211985'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '017.swc', 'sampleid': '220982'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '026.swc', 'sampleid': '221257'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '073.swc', 'sampleid': '210729'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '098.swc', 'sampleid': '210729'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '030.swc', 'sampleid': '210729'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '221253'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '050.swc', 'sampleid': '210729'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '005.swc', 'sampleid': '221260'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '010.swc', 'sampleid': '221255'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '024.swc', 'sampleid': '211988'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '032.swc', 'sampleid': '210728'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '016.swc', 'sampleid': '220981'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '211992'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 1, 'name': '031.swc', 'sampleid': '221260'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '012.swc', 'sampleid': '220982'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '017.swc', 'sampleid': '211187'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '037.swc', 'sampleid': '220983'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '044.swc', 'sampleid': '210728'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '005.swc', 'sampleid': '221252'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 1, 'name': '025.swc', 'sampleid': '221260'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '211989'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '117.swc', 'sampleid': '221100'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '041.swc', 'sampleid': '210729'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '033.swc', 'sampleid': '211466'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '034.swc', 'sampleid': '221260'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '037.swc', 'sampleid': '220982'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '026.swc', 'sampleid': '220983'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '221253'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '013.swc', 'sampleid': '221259'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '016.swc', 'sampleid': '211190'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '028.swc', 'sampleid': '211988'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '211193'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '011.swc', 'sampleid': '211989'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '221257'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '052.swc', 'sampleid': '220982'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '042.swc', 'sampleid': '210729'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '043.swc', 'sampleid': '210729'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '221260'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '063.swc', 'sampleid': '210729'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '221260'}, {'color': {'r': '150', 'g': '242', 'b': '242'}, 'mirror': 0, 'name': '024.swc', 'sampleid': '210729'}]\n",
      "[{'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '221259'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '211469'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '020.swc', 'sampleid': '220983'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '221105'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '211469'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '005.swc', 'sampleid': '220983'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '020.swc', 'sampleid': '221255'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '211473'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '221106'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '221104'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '221101'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '211470'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '221105'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '030.swc', 'sampleid': '220982'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '221259'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '221105'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '220978'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '211469'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '010.swc', 'sampleid': '221104'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '017.swc', 'sampleid': '221104'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '211469'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 1, 'name': '030.swc', 'sampleid': '211467'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '050.swc', 'sampleid': '220982'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '062.swc', 'sampleid': '221260'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '011.swc', 'sampleid': '221259'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '012.swc', 'sampleid': '221104'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '060.swc', 'sampleid': '221260'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '009.swc', 'sampleid': '221106'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '044.swc', 'sampleid': '221260'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '211185'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '221105'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '221104'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '016.swc', 'sampleid': '221104'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '010.swc', 'sampleid': '221105'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '221104'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '220981'}, {'color': {'r': '96', 'g': '237', 'b': '124'}, 'mirror': 0, 'name': '041.swc', 'sampleid': '211471'}]\n",
      "[{'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '056.swc', 'sampleid': '221260'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '029.swc', 'sampleid': '221104'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '221103'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '069.swc', 'sampleid': '211468'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '017.swc', 'sampleid': '221254'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '009.swc', 'sampleid': '221259'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '017.swc', 'sampleid': '211983'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '221104'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '057.swc', 'sampleid': '221260'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '023.swc', 'sampleid': '211467'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '221260'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '010.swc', 'sampleid': '221259'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '013.swc', 'sampleid': '211469'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '021.swc', 'sampleid': '211988'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '021.swc', 'sampleid': '220981'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '221259'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 1, 'name': '004.swc', 'sampleid': '211472'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '033.swc', 'sampleid': '221260'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 1, 'name': '062.swc', 'sampleid': '211468'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '012.swc', 'sampleid': '211188'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 1, 'name': '061.swc', 'sampleid': '211468'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '011.swc', 'sampleid': '211987'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '028.swc', 'sampleid': '211467'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '019.swc', 'sampleid': '211467'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '002.swc', 'sampleid': '211470'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '014.swc', 'sampleid': '220983'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '221104'}, {'color': {'r': '255', 'g': '188', 'b': '163'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '211186'}]\n",
      "[{'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '211188'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '006.swc', 'sampleid': '211472'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '018.swc', 'sampleid': '211185'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '034.swc', 'sampleid': '220982'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '018.swc', 'sampleid': '211472'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '043.swc', 'sampleid': '211992'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '009.swc', 'sampleid': '211188'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '010.swc', 'sampleid': '211471'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '004.swc', 'sampleid': '211467'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '006.swc', 'sampleid': '211185'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '211989'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '211186'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '019.swc', 'sampleid': '211185'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 1, 'name': '039.swc', 'sampleid': '211468'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '009.swc', 'sampleid': '211466'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '211471'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '211187'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '050.swc', 'sampleid': '211468'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '046.swc', 'sampleid': '220982'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '053.swc', 'sampleid': '211467'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '050.swc', 'sampleid': '211467'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '211185'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '220978'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '211466'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '211186'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '021.swc', 'sampleid': '211185'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '045.swc', 'sampleid': '220982'}, {'color': {'r': '255', 'g': '124', 'b': '153'}, 'mirror': 0, 'name': '043.swc', 'sampleid': '220982'}]\n",
      "[{'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '022.swc', 'sampleid': '211187'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '221098'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '031.swc', 'sampleid': '211185'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '014.swc', 'sampleid': '221254'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '105.swc', 'sampleid': '221100'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '005.swc', 'sampleid': '211471'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '026.swc', 'sampleid': '220982'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '211466'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 1, 'name': '022.swc', 'sampleid': '220982'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '010.swc', 'sampleid': '221106'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '006.swc', 'sampleid': '220978'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '033.swc', 'sampleid': '220983'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '003.swc', 'sampleid': '210731'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 1, 'name': '040.swc', 'sampleid': '221260'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 1, 'name': '028.swc', 'sampleid': '221260'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '005.swc', 'sampleid': '211993'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '115.swc', 'sampleid': '221100'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '011.swc', 'sampleid': '211185'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '009.swc', 'sampleid': '221098'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '042.swc', 'sampleid': '221260'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '005.swc', 'sampleid': '221104'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '016.swc', 'sampleid': '221099'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '015.swc', 'sampleid': '221259'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '020.swc', 'sampleid': '211187'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '024.swc', 'sampleid': '220982'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '010.swc', 'sampleid': '211187'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '042.swc', 'sampleid': '210728'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '044.swc', 'sampleid': '221098'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '041.swc', 'sampleid': '211993'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '013.swc', 'sampleid': '211472'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '007.swc', 'sampleid': '220982'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '014.swc', 'sampleid': '221257'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '008.swc', 'sampleid': '220981'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '140.swc', 'sampleid': '221100'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '001.swc', 'sampleid': '220982'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '039.swc', 'sampleid': '220982'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '011.swc', 'sampleid': '221106'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '064.swc', 'sampleid': '221100'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '013.swc', 'sampleid': '221260'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 1, 'name': '018.swc', 'sampleid': '221259'}, {'color': {'r': '127', 'g': '22', 'b': '173'}, 'mirror': 0, 'name': '043.swc', 'sampleid': '221098'}]\n"
     ]
    }
   ],
   "source": [
    "import Visual as nv\n",
    "import SwcLoader as nt\n",
    "import glutils,glm\n",
    "neuronvis = nv.neuronVis(size=(600,1000),renderModel=0,near=100,far=3000)\n",
    "neuronvis.render.setBackgroundColor((0.0,0.0,0.,1.0))\n",
    "iondata = IONData.IONData()\n",
    "path='Y:/bap/spinalcord/show_spcd_swc_831/'\n",
    "selecttype=['S1','S4','S10','S14','S15','S17','S19']\n",
    "selectneuron={'S1': ['210729031.SWC', '210728037.SWC'],\n",
    "'S4': ['211988004.SWC', '211989019.SWC'],\n",
    "'S10': ['221253002.SWC', '221253001.SWC'],\n",
    "'S14': ['211469007.SWC','221259003.SWC'],\n",
    "'S17': ['211185019.SWC', '211466009.SWC'],\n",
    "'S15': ['221103001.SWC', '211467023.SWC'],\n",
    "'S19': ['221254014.SWC', '211472013.SWC', '211993005.SWC', '221100105.SWC']\n",
    "}\n",
    "colors = [[1,1,0],[0.8,0.5,0],[0,1,1],[0.5,0.8,1],[0,1,0.78],[0,1,0.2],[0.2,1,0.2]]\n",
    "index=0\n",
    "for type in selecttype:\n",
    "    neurons = Scene.scene2List('../resource/scene/spcdmovie/'+type+'_movie.nv')\n",
    "    print(neurons)\n",
    "    if(index==1):\n",
    "        for neuron in neurons:\n",
    "            tree= nt.NeuronTree()\n",
    "            tree.somaRadius=100\n",
    "            filepath=path+neuron['sampleid']+'_'+neuron['name']\n",
    "            print(filepath)\n",
    "            if os.path.exists(filepath):\n",
    "                tree.readFile(filepath)\n",
    "                color=neuron['color']\n",
    "                neuronvis.addNeuronTree(tree,color=colors[index],somaColor=[1,1,1],mirrorToRight=neuron['mirror'],isLine=True)\n",
    "            # break\n",
    "        # break\n",
    "        neuronvis.render.setLookAt(glm.vec3(0.,18000,0.0),glm.vec3(0,0,0),glm.vec3(1.0,0.0,0.0))\n",
    "        # neuronvis.render.run()\n",
    "        neuronvis.render.animation('subtype'+type,90*index)\n",
    "    index=index+1\n",
    "    # break\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "neuronVis",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
